package com.jia.product.entity;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

import static com.jia.product.constants.ProductAttribute.PRODUCT_SALES_STATUS;
import static com.jia.product.constants.ProductAttribute.PRODUCT_UN_SALES_STATUS;

/**
 * 商品三级分类(Category)表实体类
 *
 * @author makejava
 * @since 2025-07-08 18:15:26
 */
@Getter
@Setter
@TableName("pms_category")
public class Category extends Model<Category> {
    //分类id
    @TableId
    @JsonSerialize(using = ToStringSerializer.class)
    private Long catId;
    //分类名称
    private String name;
    //父分类id
    private Long parentCid;
    //层级
    private Integer catLevel;
    //是否显示[0-不显示，1显示]
    @TableLogic(value = PRODUCT_SALES_STATUS, delval = PRODUCT_UN_SALES_STATUS)
    private Integer showStatus;
    //排序
    private Integer sort;
    //图标地址
    private String icon;
    //计量单位
    private String productUnit;
    //商品数量
    private Integer productCount;


    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
    private List<Category> children;

}

